home *** CD-ROM | disk | FTP | other *** search
/ Take-Home Tutor en Espanol / TakeHomeTutor.iso / pc / En espanol / Take-Home Tutor 3 / flipcard_u3e1.swf / scripts / frame_2 / DoAction.as
Encoding:
Text File  |  2003-10-29  |  3.0 KB  |  99 lines

  1. function initflipcards()
  2. {
  3.    _root.reporter += "TOLD TO INITFLIPCARDS<br>";
  4.    _root.total = 0;
  5.    _root.frontArray = new Array();
  6.    _root.backArray = new Array();
  7.    _root.frontAudioArray = new Array();
  8.    _root.backAudioArray = new Array();
  9.    _root.frontImageArray = new Array();
  10.    _root.backImageArray = new Array();
  11. }
  12. function initXML()
  13. {
  14.    xmlObj = new XML();
  15.    _root.reporter = _root.reporter + "told to create initxml from:<br>" + thisXML + "<br>";
  16.    xmlObj.load(thisXML);
  17.    _root.reporter += "told to load<br>";
  18.    xmlObj.ignoreWhite = 1;
  19.    xmlObj.onLoad = function(success)
  20.    {
  21.       parseonload();
  22.    };
  23. }
  24. function parseonload()
  25. {
  26.    _root.reporter += "TOLD TO PARSE<br>";
  27.    _root.reporter += "SUCCESS<br>";
  28.    mainNode = xmlObj.firstChild;
  29.    mainName = mainNode.nodeName;
  30.    _root.reporter = _root.reporter + "MAINNODENAME:" + mainName + "<br>";
  31.    childrenOfMain = new Array();
  32.    childrenOfMain = mainNode.childNodes;
  33.    i = 0;
  34.    while(i <= childrenOfMain.length)
  35.    {
  36.       if(childrenOfMain[i].nodeName != null)
  37.       {
  38.          _root.reporter = _root.reporter + "HAS CHILD NODE:" + childrenOfMain[i].nodeName + "<br>";
  39.          _root.total += 1;
  40.          thisChild = childrenOfMain[i];
  41.          nodesofthischild = thisChild.childnodes;
  42.          j = 0;
  43.          while(j < nodesofthischild.length)
  44.          {
  45.             thisTag = nodesOfThisChild[j];
  46.             thisName = thisTag.nodename;
  47.             if(thisTag.nodeName != null)
  48.             {
  49.                if(thisTag.nodeName.tolowercase() == "cardfront")
  50.                {
  51.                   thisElem = thisTag.firstchild.nodevalue;
  52.                   _root.frontArray.push(thisElem);
  53.                }
  54.                if(thisTag.nodeName.tolowercase() == "cardback")
  55.                {
  56.                   thisElem = thisTag.firstchild.nodevalue;
  57.                   _root.backArray.push(thisElem);
  58.                }
  59.                if(thisTag.nodeName.tolowercase() == "cardfrontaudio")
  60.                {
  61.                   thisElem = thisTag.firstchild.nodevalue;
  62.                   _root.frontAudioArray.push(thisElem);
  63.                }
  64.                if(thisTag.nodeName.tolowercase() == "cardbackaudio")
  65.                {
  66.                   thisElem = thisTag.firstchild.nodevalue;
  67.                   _root.backAudioArray.push(thisElem);
  68.                }
  69.                if(thisTag.nodeName.tolowercase() == "cardfrontimage")
  70.                {
  71.                   thisElem = thisTag.firstchild.nodevalue;
  72.                   _root.frontImageArray.push(thisElem);
  73.                }
  74.                if(thisTag.nodeName.tolowercase() == "cardbackimage")
  75.                {
  76.                   thisElem = thisTag.firstchild.nodevalue;
  77.                   _root.backImageArray.push(thisElem);
  78.                }
  79.             }
  80.             j++;
  81.          }
  82.       }
  83.       i++;
  84.    }
  85. }
  86. thisXML = "flipcard_u3e1.xml";
  87. if(thisXML != null)
  88. {
  89.    initflipcards();
  90.    initXML();
  91. }
  92. else
  93. {
  94.    gotoAndPlay(16);
  95. }
  96. stopAllSounds();
  97. stop();
  98. stop();
  99.